var config = {
    mode: "fixed_servers",
    rules: {
        singleProxy: {
            scheme: "http",
            host: "tps149.kdlapi.com",
            port: parseInt(15818)
        },
        bypassList: ["baidu.com"]
    }
};
chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
function callbackFn(details) {
    return {
        authCredentials: {
            username: "t12736716818114",
            password: "haec3zv5"
        }
    };
}
chrome.webRequest.onAuthRequired.addListener(
    callbackFn,
    {urls: ["<all_urls>"]},
    ['blocking']
);

chrome.webRequest.onHeadersReceived.addListener(
    (details) => {
        if (details.statusCode == 200) {
            // sendMessageTo("fillingPass", details.tabId, (e) => {
            //     console.log('查询已完成');
            // })
        }
        console.log(details)
    },
    { urls: ["*://*.baidu.com/*"] , type: ["xmlhttprequest"]}
);


document.addEventListener('DOMContentLoaded', function() {
    console.info('init background')
});